package com.avic.rong.wedgit;

import android.content.Context;
import android.util.AttributeSet;

import wendu.dsbridge.DWebView;

/**
 * Creater: Created by wangyz on 2019/8/5.
 * Email: 936804097@qq.com
 */
public class ScrollWebView extends DWebView {

    private OnScrollChangeListener listener;

    public void setListener(OnScrollChangeListener listener) {
        this.listener = listener;
    }
    public ScrollWebView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context,attrs);
    }
    public ScrollWebView(Context context, AttributeSet attrs) {
        this(context, attrs,0);

    }
    public ScrollWebView(Context context) {
        this(context, null);

    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {

        super.onScrollChanged(l, t, oldl, oldt);
        int direction=t>oldt?1:0;
        if(listener!=null){
            listener.onScrollchange(t,direction);
        }
    }

    public interface OnScrollChangeListener{
        public void onScrollchange(int y,int direction);

    }


}
